/*
 * OrderLineBO.java
 *
 * Created on March 5, 2007, 8:07 PM
 */

package edu.byu.isys413.group1E.data;

/** Stores information about an employee's position
 *
 * @author Travis Kulbeth
 */
public class OrderLineBO {
    
    private String OrderLineID;
    private ConceptualBO Conceptual;
    private String POID;
    private double lineAmount = 0.0;
    private int quantity;
    boolean alreadyInDB;
    boolean isDirty;
    
    /** Creates a new instance of OrderLineBO */
    public OrderLineBO() {
    }
    
    /** Creates a new instance of OrderLineBO using an ID
     *@param id contains the already existing id to be used for this object
     */
    public OrderLineBO(String id){
        setOrderLineID(id);
        setIsDirty(true);
    }
    
    /** Returns the Transaction Line ID
     * @return txLineID
     */
    public String getOrderLineID() {
        return OrderLineID;
    }
    
    /** Sets the transaction line id
     *@param txLineID contains ID to be used for this transaction
     */
    public void setOrderLineID(String OrderLineID) {
        setIsDirty(true);
        this.OrderLineID = OrderLineID;
    }
    
    /** Returns the revenue source id for this transaction line
     *@return revSrc
     */
    public ConceptualBO getConceptual() {
        return this.Conceptual;
    }
    
    /** Sets the revenue source id for this transaction line
     *@param revSrc contains the RevenueSourceBO to be used for this TxLine
     */
    public void setConceptual(ConceptualBO Conceptual) {
        setIsDirty(true);
        this.Conceptual = Conceptual;
    }
    
    
    /** Returns the transactionID of the transaction that
     *this transaction line applies to.
     *
     *@return transactionID
     */
    public String getPOID() {
        return POID;
    }
    
    /** Sets the transactionID of the transaction that this
     *transaction applies to.
     *
     *@param transactionID contains the id for the current transaction
     */
    public void setPOID(String POID) {
        setIsDirty(true);
        this.POID = POID;
    }
    
    /** Returns the amount for this transaction line
     * (can be affected by the coupon applied).
     *@return lineAmount
     */
    public double getLineAmount() {
        return lineAmount;
    }
    
    /** Sets the amount for this transaction line.
     *@param lineAmount contains total amount for this line
     */
    public void setLineAmount(double lineAmount) {
        setIsDirty(true);
        this.lineAmount = lineAmount;
    }
    
    /** Calculates the line amount
     */
    public void calcLineAmount(){
        setIsDirty(true);
        this.lineAmount = this.getConceptual().getAverageCost();        
    }
    
    /** Sets the alreadyInDB variable to indicate that
     * the information contained in this object has been stored in the database
     *@param is indicates whether the object is in the DB
     */
    public void setAlreadyInDB(boolean is){
        setIsDirty(true);
        this.alreadyInDB = is;
    }
    
    /** Returns if the information contained in this object has already been stored in the database
     *@return if object info was already written to DB.
     */
    public boolean isAlreadyInDB() {
        return alreadyInDB;
    }
    
    /** Returns if information has been changed within this object
     *@return if information has changed
     */
    public boolean isIsDirty() {
        return isDirty;
    }
    
    /** Sets the variable isDirty to indicate that some information has been modified or changed
     *in this object
     *@param isDirty indicates if info has changed
     */
    public void setIsDirty(boolean isDirty) {
        this.isDirty = isDirty;
    }

    /**
     * 
     * @return 
     */
    public int getQuantity() {
        return quantity;
    }

    /**
     * 
     * @param quantity 
     */
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
       
}
